namespace SmallBasicFun.Quizes
{
	public class DemoQuiz : IQuiz
	{
		public Question Question1DrawOctogon
		{
			get { return Quiz.questions[0]; }
		}


		public void StartTest()
		{
			Tortoise.InstantSpeed(true);
			GradeResults();
			InitializeScreen();
			DrawSuccess();
			Quiz.DisplayScores(1, 300);
		}

		private void DrawSuccess()
		{
			GiantTortoise.turtle.LineWidth = 1;
			var number = 360/10;
			for (var i = 0; i < number; i++)
			{
				Question1DrawOctogon.Run();
				GiantTortoise.turtle.Turn(360/number);
			}
		}


		private void InitializeScreen()
		{
			ProgramWindow.Clear();
			GraphicsWindowHelper.ResetTurtle();
			ProgramWindow.SetBackgroundColor(Colors.Black);
			GiantTortoise.turtle.X = 140;
			GiantTortoise.turtle.Y = 170;
			GiantTortoise.turtle.Angle = 0;
		}


		private void GradeResults()
		{
			Grade1Move();
		}

		private void Grade1Move()
		{
			GiantTortoise.turtle.LineColor = Colors.Black.AsColor();
			Question1DrawOctogon.Run();
			var orange = Colors.CompareColors(Colors.Orange, GiantTortoise.turtle.LineColor.ToString());
			Question1DrawOctogon.Result = orange && 8 == GiantTortoise.Sides;
		}
	}
}